package com.apps.sdses.flink141.test;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

@AllArgsConstructor
@Getter
@Setter
public class LogMessage {
    private String itemId;
    private String topic;
    private String timeStamp;
    private String status;
    private String errorMsg;

//    @Override
//    public String toString() {
//        try {
//            // 将对象转换为 JSON 字符串
//            ObjectMapper objectMapper = new ObjectMapper();
//            return objectMapper.writeValueAsString(this);
//        } catch (JsonProcessingException e) {
//            e.printStackTrace();
//            return super.toString(); // 如果转换出错，则返回默认的 toString() 方法
//        }
//    }

    public static void main(String[] args) {
        // 创建 LogMessage 实例
        LogMessage logMessage = new LogMessage("123", "topicName", "2024-01-10", "Success", "");

        // 调用 toString() 方法输出 JSON 字符串
        System.out.println(logMessage.toString());
    }
}
